<?php
  include('../init.php');
  
  if(isset($_GET["aid"])){
    $aid= $_GET["aid"];
    $sql = "DELETE FROM hs_product WHERE p_id=$aid";
    $db->execute($sql);
    
    if(file_exists('../../images/products/product/'.$aid)){
      remove_dir('../../images/products/product/'.$aid);
    } 
  }

  header("Location:products.php");
?>